define(['app'], function(app) {
    'use strict';

    // 实例化方法
    var factory = function(Http) {

        function get_data_videos(result) {
            if(false) {
                result = '{"success":true,"msg":"","result":{"advertis":[{"id":"001","video_name":"扳手介绍","video_image":"img/upload/pro-img01.jpg","video_url":"","company_profile":"博世企业博世企业博世企换单费合法回复回复黄飞鸿发挥法规和复合肥回复回复合法花非花业博世企业博世企业","apply_time":"2017/01/01 09:00:00","view_count":15000},{"id":"002","video_name":"工具介绍","video_image":"img/upload/pro-img01.jpg","video_url":"","company_profile":"博世企业","apply_time":"2017/01/01 09:00:00","view_count":1050}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            } else {
                return result;
            }
        }

        //删除
        function get_data_detele(result) {
            if(false) {
                result = '{"success":true,"msg":"","result":"","session":"7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            } else {
                return result;
            }
        }

        // 返回信息
        return {
            getvideolist: function(status, nPage, callback, calldone) {
                Http.post({
                        method: 'info.starenterprise.getlist',
                        status: status,
                        nPage: nPage
                    },
                    function(result) {
                        //请求成功
                        if(callback)
                            callback(get_data_videos(result).result);
                    },
                    function(e) {
                        //请求异常
                    },
                    function() {
                        //请求完成，一般不做什么事情
                        if(calldone)
                            calldone();
                    });
            },
            del_video:function(id,callback){
                Http.post({
                    method: 'info.starenterprise.delete',
                        id:id
                },
                    function(result) {
                        //请求成功
                        if(callback)
                            callback(get_data_detele(result));
                    },
                    function(e) {
                        //请求异常
                    },
                    function() {
                        //请求完成，一般不做什么事情
                        if(calldone)
                            calldone();

                    });
            }

        };
    }

    factory.$inject = ['Http'];
    return app.registerService("Starbusiness_publicity", factory);

});